package com.jspgou.cms.manager.impl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jspgou.core.entity.Website;
import com.jspgou.cms.entity.Cart;
import com.jspgou.cms.entity.ShopMember;
import com.jspgou.cms.manager.CartMng;
import com.jspgou.cms.manager.GiftSvcMng;

@Service
@Transactional
public class GiftSvcMngImpl implements GiftSvcMng {

	public Cart addToCart(Long giftId, int count, boolean isAdd,
			ShopMember member, Website web, HttpServletRequest request,
			HttpServletResponse response) {
		Cart cart = cartMng.addGift(giftId, count, isAdd, member.getId(),
				web.getId());
//		Cookie cookie = createCookie(cart.getTotalItems().toString(), request);
//		response.addCookie(cookie);
		return cart;
	}
	
	@Autowired
	private CartMng cartMng;
}